Make sure we always have a sensible idle function; this fixes problems
authorSteven Hand <steven@xensource.com>
Thu, 4 Jan 2007 10:58:01 +0000 (10:58 +0000)
committerSteven Hand <steven@xensource.com>
Thu, 4 Jan 2007 10:58:01 +0000 (10:58 +0000)
booting dom0 on AMD introduced by -unstable cset 13213:bf25488db8eb.

Signed-off-by: Steven Hand <steven@xensource.com>
linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c
linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c

index 00a8d8a8ebabc814ef898ddd8400cafd978f5853..0dbc6a412e4f716a7fb58a591bad8a588a96a7a8 100644 (file)
@@ -168,17 +168,22 @@ void cpu_idle(void)
        /* endless idle loop with no priority at all */
        while (1) {
                while (!need_resched()) {
+                       void (*idle)(void);
 
                        if (__get_cpu_var(cpu_idle_state))
                                __get_cpu_var(cpu_idle_state) = 0;
 
                        rmb();
+                       idle = pm_idle;
+
+                       if (!idle)
+                               idle = xen_idle;
 
                        if (cpu_is_offline(cpu))
                                play_dead();
 
                        __get_cpu_var(irq_stat).idle_timestamp = jiffies;
-                       pm_idle();
+                       idle();
                }
                preempt_enable_no_resched();
                schedule();
@@ -216,8 +221,6 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
 
 void __devinit select_idle_routine(const struct cpuinfo_x86 *c)
 {
-       if (!pm_idle)
-               pm_idle = xen_idle;
 }
 
 static int __init idle_setup (char *str)
index c12ebe0e0182c0ba04ef58bae9dab35f719568fd..8267a772b77fe4e01cce1b992372f6c85593d31b 100644 (file)
@@ -182,14 +182,18 @@ void cpu_idle (void)
        /* endless idle loop with no priority at all */
        while (1) {
                while (!need_resched()) {
+                       void (*idle)(void);
+
                        if (__get_cpu_var(cpu_idle_state))
                                __get_cpu_var(cpu_idle_state) = 0;
                        rmb();
-                       
+                       idle = pm_idle;
+                       if (!idle)
+                               idle = xen_idle;
                        if (cpu_is_offline(smp_processor_id()))
                                play_dead();
                        enter_idle();
-                       pm_idle();
+                       idle();
                        __exit_idle();
                }
 
@@ -230,8 +234,6 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
 
 void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 
 {
-       if (!pm_idle)
-               pm_idle = xen_idle;
 }
 
 static int __init idle_setup (char *str)